

ENTRYPOINT	= 0x30400
ASM		= nasm
CC		= gcc
LD		= ld
 

ASMKFLAGS	= -f elf -I include/
CFLAGS		= -c -fno-builtin -fno-stack-protector -I include/
LDFLAGS		= -s -Ttext $(ENTRYPOINT)

# This Program 
ORANGESKERNEL	= kernel.bin
OBJS		= kernel.o KeStart.o string.o  interupt.o schdule.o main.o lib.o keyboard.o tty.o console.o
# All Phony Targets 
.PHONY : everything  clean

# Default starting position
everything : $(ORANGESKERNEL)


clean :
	rm -f $(OBJS)

$(ORANGESKERNEL) : $(OBJS)
	$(LD) $(LDFLAGS) -o $(ORANGESKERNEL) $(OBJS)

kernel.o : kernel/kernel.asm
	$(ASM) $(ASMKFLAGS) -o $@ $<

KeStart.o: kernel/KeStart.c
	$(CC) $(CFLAGS) -o $@ $<
	
interupt.o: kernel/interupt.c
	$(CC) $(CFLAGS) -o $@ $<

schdule.o: kernel/schdule.c
	$(CC) $(CFLAGS) -o $@ $<
 
main.o: kernel/main.c
	$(CC) $(CFLAGS) -o $@ $<
	
string.o : lib/string.asm
	$(ASM) $(ASMKFLAGS) -o $@ $<
	
keyboard.o: kernel/keyboard.c
	$(CC) $(CFLAGS) -o $@ $<
	
tty.o: kernel/tty.c
	$(CC) $(CFLAGS) -o $@ $<
	
console.o: kernel/console.c
	$(CC) $(CFLAGS) -o $@ $<

lib.o : lib/lib.asm
	$(ASM) $(ASMKFLAGS) -o $@ $<	



